{extend name="sitehome@style/base"/}
{block name="resources"}
{/block}
{block name="main"}
<div class="layui-form">
    <div class="nc-quote-box">
        <blockquote class="layui-elem-quote layui-quote-nm">属性修改</blockquote>
        <div class="layui-form-item">
            <label class="layui-form-label"><span class="required">*</span>属性名称</label>
            <div class="layui-input-inline">
                <input type="text" name="attribute_name" value="{$attribute_find.name}" lay-verify="attribute_name" autocomplete="off" placeholder="" class="layui-input nc-len-long">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">类型</label>
            <div class="layui-input-inline">
                <select name="input_type"  class="nc-len-long" lay-filter="input_type" >
                    <option value="0">请选择</option>
                    {volist name="input_type_arr" id="vo"}
                    <option value="{$vo.type}" {if $vo.type == $attribute_find.input_type} selected="selected" {/if}>{$vo.name}</option>
                    {/volist}
                </select>
            </div>
        </div>

        <!--单行文本-->
        <div class="layui-form-item nc_hide" data-name="args_text" {if $attribute_find.input_type == 'text' }style="display: block ;" {/if}>
            <label class="layui-form-label">最大长度</label>
            <div class="layui-input-inline">
                <input type="text" name="text_length" value="{$attribute_find.input_args.text_length}" autocomplete="off" placeholder="" class="layui-input nc-len-short">
            </div>
        </div>
        <div class="layui-form-item nc_hide" data-name="args_text" {if $attribute_find.input_type == 'text' }style="display: block ;" {/if}>
            <label class="layui-form-label">默认值</label>
            <div class="layui-input-inline">
                <input type="text" name="text_default_value" value="{$attribute_find.input_args.text_default_value}" autocomplete="off" placeholder="" class="layui-input nc-len-mid">
            </div>
        </div>
        
        <!--多行文本框-->
        <div class="layui-form-item nc_hide" data-name="args_textarea" {if $attribute_find.input_type == 'textarea' }style="display: block ;" {/if}>
            <label class="layui-form-label">宽</label>
            <div class="layui-input-inline">
                <input type="text" name="textarea_width" value="{$attribute_find.input_args.textarea_width}"  autocomplete="off" placeholder="" class="layui-input nc-len-short">
            </div>
        </div>
        <div class="layui-form-item nc_hide" data-name="args_textarea" {if $attribute_find.input_type == 'textarea' }style="display: block ;" {/if}>
            <label class="layui-form-label">高</label>
            <div class="layui-input-inline">
                <input type="text" name="textarea_height" value="{$attribute_find.input_args.textarea_height}" autocomplete="off" placeholder="" class="layui-input nc-len-short">
            </div>
        </div>
        <div class="layui-form-item nc_hide" data-name="args_textarea" {if $attribute_find.input_type == 'textarea' }style="display: block ;" {/if}>
            <label class="layui-form-label">默认值</label>
            <div class="layui-input-inline">
                <input type="text" name="textarea_default_value" value="{$attribute_find.input_args.textarea_default_value}" autocomplete="off" placeholder="" class="layui-input nc-len-short">
            </div>
        </div>

        <!--编辑器-->
        <div class="layui-form-item nc_hide" data-name="args_editor" {if $attribute_find.input_type == 'editor' }style="display: block ;" {/if}>
            <label class="layui-form-label">高</label>
            <div class="layui-input-inline">
                <input type="text" name="editor_height" value="{$attribute_find.input_args.editor_height}" autocomplete="off" placeholder="" class="layui-input nc-len-short">
            </div>
        </div>
        <div class="layui-form-item nc_hide" data-name="args_editor" {if $attribute_find.input_type == 'editor' }style="display: block ;" {/if}>
            <label class="layui-form-label">默认值</label>
            <div class="layui-input-inline">
                <input type="text" name="editor_default_value" value="{$attribute_find.input_args.editor_default_value}" autocomplete="off" placeholder="" class="layui-input nc-len-short">
            </div>
        </div>

        <!--下拉框-->
        <div class="layui-form-item nc_hide" data-name="args_select" {if $attribute_find.input_type == 'select' }style="display: block ;" {/if}>
            <label class="layui-form-label">选项列表</label>
            <div class="layui-input-inline">
                <input type="text" name="select_option" value="{$attribute_find.input_args.select_option}" autocomplete="off" placeholder="例：男/女" class="layui-input nc-len-short">
            </div>
        </div>
        <div class="layui-form-item nc_hide" data-name="args_select" {if $attribute_find.input_type == 'select' }style="display: block ;" {/if}>
            <label class="layui-form-label">默认值</label>
            <div class="layui-input-inline">
                <input type="text" name="select_default_value" value="{$attribute_find.input_args.select_default_value}" autocomplete="off" placeholder="" class="layui-input nc-len-short">
            </div>
        </div>

        <!--单选按钮-->
        <div class="layui-form-item nc_hide" data-name="args_radio" {if $attribute_find.input_type == 'radio' }style="display: block ;" {/if}>
            <label class="layui-form-label">选项列表</label>
            <div class="layui-input-inline">
                <input type="text" name="radio_option" value="{$attribute_find.input_args.radio_option}" autocomplete="off" placeholder="例：男/女" class="layui-input nc-len-short">
            </div>
        </div>
        <div class="layui-form-item nc_hide" data-name="args_radio" {if $attribute_find.input_type == 'radio' }style="display: block ;" {/if}>
            <label class="layui-form-label">默认值</label>
            <div class="layui-input-inline">
                <input type="text" name="radio_default_value" value="{$attribute_find.input_args.radio_default_value}" autocomplete="off" placeholder="" class="layui-input nc-len-short">
            </div>
        </div>

        <!--复选框-->
        <div class="layui-form-item nc_hide" data-name="args_checkbox"  {if $attribute_find.input_type == 'checkbox' }style="display: block ;" {/if}>
            <label class="layui-form-label">选项列表</label>
            <div class="layui-input-inline">
                <input type="text" name="checkbox_option" value="{$attribute_find.input_args.checkbox_option}"  autocomplete="off" placeholder="例：男/女" class="layui-input nc-len-short">
            </div>
        </div>
        <div class="layui-form-item nc_hide" data-name="args_checkbox" {if $attribute_find.input_type == 'checkbox' }style="display: block ;" {/if}>
            <label class="layui-form-label">默认值</label>
            <div class="layui-input-inline">
                <input type="text" name="checkbox_default_value" value="{$attribute_find.input_args.checkbox_default_value}" autocomplete="off" placeholder="" class="layui-input nc-len-short">
            </div>
        </div>

        <!--图片-->
        <div class="layui-form-item nc_hide" data-name="args_img" {if $attribute_find.input_type == 'img' }style="display: block ;" {/if}>
            <label class="layui-form-label">允许图片类型</label>
            <div class="layui-input-inline">
                <input type="text" name="img_allow_image_type" value="{$attribute_find.input_args.img_allow_image_type}" autocomplete="off" value="jpg,png,gif" placeholder="" class="layui-input nc-len-short">
            </div>
        </div>
        <div class="layui-form-item nc_hide" data-name="args_img" {if $attribute_find.input_type == 'img' }style="display: block ;" {/if}>
            <label class="layui-form-label">开启图片水印</label>
            <div class="layui-input-inline">
                <select name="img_open_image_mark"  class="nc-len-long">
                    <option value="0" {if $attribute_find.input_args.img_open_image_mark == 0 } selected='selected' {/if}>否</option>
                    <option value="1" {if $attribute_find.input_args.img_open_image_mark == 1 } selected='selected' {/if}>是</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item nc_hide" data-name="args_img" {if $attribute_find.input_type == 'img' }style="display: block ;" {/if}>
            <label class="layui-form-label">缩略图宽</label>
            <div class="layui-input-inline">
                <input type="text" name="img_width" value="{$attribute_find.input_args.img_width}" autocomplete="off" value="" placeholder="" class="layui-input nc-len-short">
            </div>
        </div>
        <div class="layui-form-item nc_hide" data-name="args_img" {if $attribute_find.input_type == 'img' }style="display: block ;" {/if}>
            <label class="layui-form-label">缩略图高</label>
            <div class="layui-input-inline">
                <input type="text" name="img_height" value="{$attribute_find.input_args.img_height}" autocomplete="off" value="" placeholder="" class="layui-input nc-len-short">
            </div>
        </div>

        <!--多图片-->
        <div class="layui-form-item nc_hide" data-name="args_imgs" {if $attribute_find.input_type == 'imgs' }style="display: block ;" {/if}>
            <label class="layui-form-label">允许图片类型</label>
            <div class="layui-input-inline">
                <input type="text" name="imgs_allow_image_type" value="{$attribute_find.input_args.imgs_allow_image_type}" autocomplete="off" value="jpg,png,gif" placeholder="" class="layui-input nc-len-short">
            </div>
        </div>
        <div class="layui-form-item nc_hide" data-name="args_imgs" {if $attribute_find.input_type == 'imgs' }style="display: block ;" {/if}>
            <label class="layui-form-label">开启图片水印</label>
            <div class="layui-input-inline">
                <select name="imgs_open_image_mark"  class="nc-len-long">
                    <option value="0" {if $attribute_find.input_args.imgs_open_image_mark == 0 } selected='selected' {/if} >否</option>
                    <option value="1" {if $attribute_find.input_args.imgs_open_image_mark == 1 } selected='selected' {/if} >是</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item nc_hide" data-name="args_imgs" {if $attribute_find.input_type == 'imgs' }style="display: block ;" {/if}>
            <label class="layui-form-label">缩略图宽</label>
            <div class="layui-input-inline">
                <input type="text" name="imgs_width" value="{$attribute_find.input_args.imgs_width}" autocomplete="off" value="" placeholder="" class="layui-input nc-len-short">
            </div>
        </div>
        <div class="layui-form-item nc_hide" data-name="args_imgs" {if $attribute_find.input_type == 'imgs' }style="display: block ;" {/if}>
            <label class="layui-form-label">缩略图高</label>
            <div class="layui-input-inline">
                <input type="text" name="imgs_height" value="{$attribute_find.input_args.imgs_height}"  autocomplete="off" value="" placeholder="" class="layui-input nc-len-short">
            </div>
        </div>

        <!--文件上传-->
        <div class="layui-form-item nc_hide" data-name="args_file" {if $attribute_find.input_type == 'file' }style="display: block ;" {/if}>
            <label class="layui-form-label">允许文件类型</label>
            <div class="layui-input-inline">
                <input type="text" name="file_allow_file_type" value="{$attribute_find.input_args.file_allow_file_type}" autocomplete="off" value="rar,zip,doc,docx" placeholder="" class="layui-input nc-len-short">
            </div>
        </div>

        <!--多文件上传-->
        <div class="layui-form-item nc_hide" data-name="args_files" {if $attribute_find.input_type == 'files' }style="display: block ;" {/if}>
            <label class="layui-form-label">允许文件类型</label>
            <div class="layui-input-inline">
                <input type="text" name="files_allow_file_type" value="{$attribute_find.input_args.files_allow_file_type}" autocomplete="off" value="rar,zip,doc,docx" placeholder="" class="layui-input nc-len-short">
            </div>
        </div>

        <!--数字-->
        <div class="layui-form-item nc_hide" data-name="args_number" {if $attribute_find.input_type == 'number' }style="display: block ;" {/if}>
            <label class="layui-form-label">取值范围</label>
            <div class="layui-input-inline nc-len-shor">
                <input type="number" name="number_min" value="{$attribute_find.input_args.number_min}" autocomplete="off" placeholder="" class="layui-input nc-len-short">
            </div>
            <div class="layui-form-mid">-</div>
            <div class="layui-input-inline nc-len-shor">
                <input type="number" name="number_max" value="{$attribute_find.input_args.number_max}" autocomplete="off" placeholder="" class="layui-input nc-len-short">
            </div>
        </div>
        <div class="layui-form-item nc_hide" data-name="args_number"  {if $attribute_find.input_type == 'number' }style="display: block ;" {/if}>
            <label class="layui-form-label">小数位数</label>
            <div class="layui-input-inline">
                <select name="number_decimal_places"  class="nc-len-long">
                    <option value="0" {if $attribute_find.input_args.number_decimal_places == 0 } selected='selected' {/if}>0</option>
                    <option value="1" {if $attribute_find.input_args.number_decimal_places == 1 } selected='selected' {/if}>1</option>
                    <option value="2" {if $attribute_find.input_args.number_decimal_places == 2 } selected='selected' {/if}>2</option>
                    <option value="3" {if $attribute_find.input_args.number_decimal_places == 3 } selected='selected' {/if}>3</option>
                    <option value="4" {if $attribute_find.input_args.number_decimal_places == 4 } selected='selected' {/if}>4</option>
                    <option value="5" {if $attribute_find.input_args.number_decimal_places == 5 } selected='selected' {/if}>5</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item nc_hide" data-name="args_number"  {if $attribute_find.input_type == 'number' }style="display: block ;" {/if}>
            <label class="layui-form-label">默认值</label>
            <div class="layui-input-inline">
                <input type="text" name="number_default_value" value="{$attribute_find.input_args.number_default_value}" autocomplete="off" placeholder="" class="layui-input nc-len-short">
            </div>
        </div>

        <!--时间-->
        <div class="layui-form-item nc_hide" data-name="args_time" {if $attribute_find.input_type == 'time' }style="display: block ;" {/if}>
            <label class="layui-form-label">时间格式</label>
            <div class="layui-input-inline">
                <select name="time_style"  class="nc-len-long">
                    <option value="Y-m-d" {if $attribute_find.input_args.time_style == "Y-m-d" } selected='selected' {/if} >年月日</option>
                    <option value="Y-m-ds" {if 'Y-m-ds' == $attribute_find.input_args.time_style } selected='selected' {/if} >年月日 时分秒</option>
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">属性后缀</label>
            <div class="layui-input-inline">
                <input type="text" name="postfix" autocomplete="off" value="{$attribute_find.postfix}" placeholder="选填 例：㎡、㎞、㎏、元" class="layui-input nc-len-long">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">字段提示</label>
            <div class="layui-input-inline">
                <input type="text" name="placeholder" value="{$attribute_find.placeholder}" autocomplete="off" placeholder="" class="layui-input nc-len-long">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">检验正则</label>
            <div class="layui-input-inline">
                <input type="text" name="reg" value="{$attribute_find.reg}" autocomplete="off" placeholder="" class="layui-input nc-len-mid">
            </div>
            <div class="layui-input-inline">
                <select name="reg_type"  class="nc-len-long" lay-filter="reg_type">
                    <option value="0">请选择</option>
                    {volist name="input_regex_arr" id="vo"}
                    <option value="{$vo.regex_value}" {if $vo.regex_value == $attribute_find.reg }selected="selected"{/if} >{$vo.regex_name}</option>
                    {/volist}
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">值唯一</label>
            <div class="layui-input-inline">
                <select name="unique"  class="nc-len-long">
                    <option value="0" {if 0 == $attribute_find.unique }selected="selected"{/if}>否</option>
                    <option value="1" {if 1 == $attribute_find.unique }selected="selected"{/if}>是</option>
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">必填</label>
            <div class="layui-input-inline">
                <select name="required"  class="nc-len-long">
                    <option value="0" {if 0 == $attribute_find.required }selected="selected"{/if}>否</option>
                    <option value="1" {if 1 == $attribute_find.required }selected="selected"{/if}>是</option>
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">可搜索</label>
            <div class="layui-input-inline">
                <select name="search_able"  class="nc-len-long">
                    <option value="1" {if 1 == $attribute_find.search_able }selected="selected"{/if}>是</option>
                    <option value="0" {if 0 == $attribute_find.search_able }selected="selected"{/if}>否</option>
                </select>
            </div>
        </div>

        <div class="nc-form-row">
            <input type="hidden" name="category_id" value="{$attribute_find.category_id}">
            <input type="hidden" name="attribute_id" value="{$attribute_find.attribute_id}">
            <button class="layui-btn" lay-submit lay-filter="btnAttribute" type="button">保存</button>
            <button onclick="window.history.back(-1)" class="layui-btn layui-btn-primary">返回</button>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script>
    var url = "sns://sitehome/info/editCategoryAttribute";
</script>
<script src="SNS_JS/category_attribute.js"></script>
{/block}